<template>
	<view class="content">
		<!-- 头部 -->
		<view class="header_content">
            <image src="../../static/logo.png" ></image>
            <view>{{ loginData.uname || '' }}</view>
		</view>
        <view class="menu_content">
            <view class="menu_item" v-for="(item, index) in menusList" :key="index" @click="handleItem(item)">
                <text style="margin-right: 15rpx; color: #ffac60; font-size: 30rpx;" class="iconfont" :class="item.icon"></text>
                <view class="label">{{ item.name }}</view>
                <text class="iconfont icon-xiangyoujiantou"></text>
            </view>
        </view>
	</view>
</template>

<script>
import customHeader from "@/components/custom-header/custom-header.vue";
	export default {
		components: {
			customHeader,
		},
		data() {
			return {
				statusBarHeight: 0,
                menusList: [
                    { name: '修改密码', icon: 'icon-xiugaimima', path: '../../pages/login/changePassword', active: false },
                    // { name: '个人资料', icon: 'icon-wode', path: '../../pages/login/personalInfo', active: false },
                    { name: '退出登陆', icon: 'icon-wode', path: '../../pages/login/login2', active: false },
                    { name: '网络配置', icon: 'icon-wangluo', path: '', active: false },
                    { name: '联系客服-17855898445', icon: 'icon-tuichu', path: '', active: false },
                ],
                obj: {
                    '退出登陆': (item) => {
                        uni.showModal({
                            title: '提示',
                            content: '是否注销用户',
                            success: (res) => {
                                if (res.confirm) {
                                    uni.removeStorageSync('token');
                                    uni.removeStorageSync('loginData');
                                    uni.redirectTo({
                                        url: item.path
                                    })
                                }
                            }
                        });
                    },
                    '联系客服-17855898445': () => {
                        uni.makePhoneCall({
                            phoneNumber: '17855898445'
                        })
                    },
                    '修改密码': (item) => {
                        uni.navigateTo({
                            url: item.path
                        })
                    },
                    '网络配置': (item) => {
                        uni.showToast({
                            title: uni.getStorageSync('baseUrl') || {},
                            icon: 'none',
                            duration: 2000
                        });
                    },
                    // '个人资料': (item) => {
                    //     uni.navigateTo({
                    //         url: item.path
                    //     })
                    // }
                },
                loginData: uni.getStorageSync('loginData') || {}
			}
		},
        computed: {},
		onLoad() {},
		methods: {
            handleItem(item) {
                this.obj[item.name](item)
            }
		}
	}
</script>

<style lang="less" scoped>
.content {
    height: 100vh;
    font-size: 16rpx;
    background: #fff;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;

    .header_content {
		color: #FFFFFF;
		height: 180upx;
		width: 100%;
		background: #FFAC60 !important;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 40upx;
	}

	.header_content image {
		width: 120upx;
		height: 120upx;
	}

    .menu_content {
        background: #fff;
        font-size: 20rpx;

        .menu_item {
            display: flex;
            align-items: center;
            padding:  20rpx;
            border-bottom: 1rpx solid #ccc;

            .label {
                flex: 1;
            }
            .iconfont {
                font-size: 20rpx;
            }
        }
    }
	
}
</style>
